<?php

namespace app\api\controller;

use app\common\controller\ApiBase;
use app\common\model\artwork\Fbx as FbxModel;
use app\common\validate\artwork\Fbx as FbxValidate;

class Fbx extends ApiBase
{

    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];

    public function index()
    {
        $this->checkRequestParam(FbxValidate::class);

        $data = FbxModel::alias('fbx')
            ->where([
                'fbx.id' => $this->request->param('id'),
            ])
            ->with([
                'category' => function ($query) {
                    $query->withField(['id', 'pid', 'type', 'name','nickname', 'flag','status']);
                }])
            ->find();
        if (!$data) {
            $this->error('数据不存在');
        }

        return $this->success('成功', $data);
    }

}
